<!DOCTYPE html>
<html class="x-admin-sm">
{include file='public/header'}
<script src="/admin/xadmin/lib/layui/upload.js" charset="utf-8"></script>
<style>
    .layui-form-label{
        width: 120px;
    }
    .layui-input-block{
        margin-left: 150px;
    }
    #selectAccount .layui-input-block{
        margin-left: 0;
    }
</style>
<body>
    <div class="x-body">
        <form class="layui-form" lay-filter="formAjax">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>投放平台
                </label>
                <div id="pMenu" style="width:100%;flex:1"></div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>关键词
                </label>
                <div class="layui-input-block">
                    <input type="text" name="subject" autocomplete="off" class="layui-input" placeholder="请输入关键词" value="" />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>返点
                </label>
                <div class="layui-input-block">
                    <input type="number" name="rebate" autocomplete="off" class="layui-input" value="" placeholder="请输入0~100之间的整数" />
                </div>
            </div>

            <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="display: none;" />

        </form>
    </div>
    <script>
        let params = {
            addUrl: '/cps/account/batchUpdate',
        }
        form_ajax(params)

        let selectParams = {
            url: '/cps/link/getLaunchMedia',
            selected: [],
            tips: '选择平台',
            name: 'platform',
            field_id: 'id',
            field_Name: 'name',
            elem: '#pMenu',
            disabled:false
        }

        let id = GetQueryString('id')

        new Promise(function(reslove){
            if(id){
                Ajax(params.detailUrl, { id }).then(result => {
                    selectParams.disabled = true
                    selectParams.selected = [result.data.platform]
                    changeMediaUrl(result.data.media_id+'')
                    reslove()
                });
            }else{
                reslove()
            }
        }).then(function(){
            selectN(selectParams)
        })
        
    </script>
</body>

</html>